/**
 * @Copyright (C) 2019 广州金鹏集团有限公司.
 * 本系统是商用软件,未经授权擅自复制或传播本程序的部分或全部将是非法的.
 * @创建人: 赵力
 * @创建时间: 2019-01-25 15:29
 * @版本: V1.0
 */
package com.ikcai.enginegraph.service.impl;

import com.ikcai.enginegraph.domain.node.Weapon;
import com.ikcai.enginegraph.respository.WeaponRepository;
import com.ikcai.enginegraph.service.IWeaponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @类功能说明: 武器服务实现类
 * @创建人: 赵力
 * @创建时间: 2019-01-25 15:29
 */
@Service
public class WeaponServiceImpl implements IWeaponService {

    @Autowired
    WeaponRepository weaponRepository;

    @Override
    public Weapon addWeapon(Weapon weapon) {
        return weaponRepository.save(weapon);
    }

    @Override
    public Weapon addWeaponByName(String name) {
        Weapon weapon = new Weapon();
        weapon.setName(name);
        return weaponRepository.save(weapon);
    }

    @Override
    public boolean deleteWeaponById(Long id) {
        weaponRepository.deleteById(id);
        return true;
    }
}
